<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%  request.setCharacterEncoding( "GB2312");%>
<%@ page import="model.User"%>
<%@ page import="model.Student"%>
<%@ page import="dao.WeiGuiDao"%>
<%@ page import="java.util.List" %>

<%
	//检查会话中是否有 "sg" 属性
	Object fdyObj = session.getAttribute("sg");
	if (fdyObj == null) {
	    response.sendRedirect("../view/Login.jsp");
	    return;
	}
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>宿管页面</title>
<link href="../css/Utils.css" rel="stylesheet" type="text/css" />
<link href="../css/List.css" rel="stylesheet" type="text/css" />
<!-- 违规功能部分样式 -->
<link href="../css/WeiGuiSG_edit.css" rel="stylesheet" type="text/css" />
<!-- 退出登录专用 -->
   <script type="text/javascript" src="../view/Loginout.js"></script>
</head>
<body>

<!-- 头部 -->
<div class="header" ><br>
<nerong>&nbsp;&nbsp;宿管页面&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;</nerong>
<button onclick="confirmLogout('<%= (String)session.getAttribute("sg") %>','sg')">退出登录</button>

</div><br>

<div class="left" >
<table width="80%" height="80%">
<th>
<nerong>宿管可选择内容</nerong>

</th>
<tr>
<td>
<a href="../View_Msg/msgSg.jsp">&emsp;个人信息</a><br>
</td>
</tr>

<tr>
<td>
<a href="../View_SuShe/SuSheSG_List.jsp">&emsp;楼栋学生信息查询</a><br>
</td>
</tr>
<tr>

<td>
<a href="../View_fix/SgFix.jsp">&emsp;公物报修</a><br>

</td>
</tr>

<tr>
<td>
<a href = "WeiGuiSG.jsp">&emsp;宿舍违规信息处理</a><br>
</td>
</tr>


</table>
</div>


<div class="context" >
<!-- 这部分是每个大功能的小功能 -->
 <h2>违规情况增加</h2>
		
	<form id="registerForm" method="POST" action="../AddWeiGuiServlet" >
    	
    	<label for="id">学生学号:</label>
    	   <select name="id" id="id">
            <option value="">请选择学生学号</option>
    <%
  				
    			WeiGuiDao dao = new WeiGuiDao();
    			List<User> wg = dao.getAllid();
    			
                // 遍历宿舍号列表，生成下拉菜单选项
                for (User wgs :wg) {
            %>
            <option value="<%= wgs.getId() %>"><%= wgs.getId() %></option>
            <%
                }
            %>
            
        </select><br><br>
		<!-- AJAX反馈信息显示 -->
    	<label id="StudentIDMessage" style="color: black;"></label>
    	<label for="time">时间:</label>
    	<input type="datetime-local" id="time" name="time"><br><br>

    	<label for="type">类型:</label>
    	<select id="type" name="type">
    		<option value="生活">生活</option>
    		<option value="考勤">考勤</option>
		</select><br><br>
     
    	<label for="because">原因:</label>
    	<input type="text" id="because" name="because"><br><br>
    
    	 <label for="dormNumber">宿舍号:</label>
        <select name="dormNumber" id="dormNumber">
            <option value="">请选择宿舍号</option>
    <%
  				//获取宿管楼栋
				String build = (String)session.getAttribute("sgbuild");
	
    			WeiGuiDao sdao = new WeiGuiDao();
    			List<Student> wga = sdao.getAllroom(build);
    			
                // 遍历宿舍号列表，生成下拉菜单选项
                for (Student wgs :wga) {
            %>
            <option value="<%= wgs.getRoomid() %>"><%= wgs.getRoomid() %></option>
            <%
                }
            %>
            
        </select>
    	<input type="submit" value="提交"><br><br> 
    	<a href="WeiGuiSG.jsp">返回</a>
</form>

</div>

</body>
</html>